<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta content="phalconplus API doc" name="description">
    <title>
                    phalconplus API Documentation
            </title>
    <link rel="stylesheet" type="text/css" href="../../../asset/static/prettify.css" />

<script src="../../../asset/static/prettify.js"></script>
<script src="../../../asset/api_definition.js"></script>


                        <link rel="stylesheet" type="text/css" href="../../../asset/static/prettify.css" />
                    <link rel="stylesheet" type="text/css" href="../../../asset/static/zephir-theme.css" />
            
    

                        <script src="../../../asset/static/prettify.js"></script>
                                    <script src="../../../asset/api_definition.js"></script>
                    <script src="../../../asset/static/jquery.min.js"></script>
                    <script src="../../../asset/static/zephir-doc.js"></script>
                <script type="application/javascript">let ZepCurrentPath = '../../../'</script>
    </head>
 <body onload="prettyPrint()">
        <div id="top-bar">
            <div id="top-left">
                                    phalconplus Documentation <span class="version">v1.3.0-development</span>
                            </div>
            <div id="top-right">
            </div>
        </div>
        <div id="body">
            <div id="body-left">
                <div class="header-search">
                    <input class="search-box" placeholder="Search for a class or namespace " type="text" />
                    <div id="menu-wrapper">
                    </div>
                </div>
            </div>
            <div id="body-right">
                <div class="content">
                    
<div class="breadcrumb">
    
    <ul>
        
        <li><a href="../../../index.html">Home</a></li>
        
                <li><a href="../../../classes.html">Classes</a></li>
                <li><a href="../../../class/PhalconPlus/Logger/MultiPleFile.html">PhalconPlus\Logger\MultiPleFile</a></li>
                <li><a >Source</a></li>
                
    </ul>
    
</div>
<div class="class-header source clearfix">
    
    <div class="access-buttons">
        <a class="zep-button" href="../../../class/PhalconPlus/Logger/MultiPleFile.html">Class</a>

            </div>
    
    <div class="class-full-name">
        <span class="class-type">Class</span>
        
                <span class="namespace-piece">
            <a href="../../../namespace/PhalconPlus.html">PhalconPlus</a>
        </span>
                <span class="namespace-piece">
            <a href="../../../namespace/PhalconPlus/Logger.html">Logger</a>
        </span>
        
        <h1 class="class-name">MultiPleFile</h1>
    </div>
    
</div>

<pre class="zephir-source-file prettyprint linenums">
    namespace PhalconPlus\Logger;
use PhalconPlus\Logger\Processor\AbstractProcessor;

class MultiPleFile extends \Phalcon\Logger\MultiPle
{
    protected processors = [] { get };

    public function  __construct(array! options)
    {  
        var opt, logger;
        for opt in options {
            let logger = new \Phalcon\Logger\Adapter\File(opt["filePath"]);
            logger->setLogLevel(opt["level"]);
            this->push(logger);
        }
    } 
    
    public function addProcessor(string! name, <AbstractProcessor> processor)
    {
        let this->processors[name] = processor;
        return this;
    }

    public function getProcessorVar(string! name)  -> string
    {
        var processor;
        if fetch processor, this->processors[name] {
            return (string) processor;
        }
        return "";
    }

    public function __get(string! property) -> string
    {
        return this->getProcessorVar(property);
    }

	/**
	 * Sends a message to each registered logger
	 */
     public function log(var type, var message = null, array! context = null)
     {
         var loggers, logger, name, processor, custormContext = [];
 
         if empty(context) {
             if !empty(this->processors) {
                for name, processor in this->processors {
                    let custormContext[name] = processor->__toString();
                }
            }
         } else {
             let custormContext = context;
         }

         let loggers = this->_loggers;
         if typeof loggers == "array" {
             for logger in loggers {
                 if logger->getLogLevel() === \Phalcon\Logger::SPECIAL { 
                    logger->log(type, message, custormContext);
                 }
                 if(logger->getLogLevel() === type) {
                    logger->log(type, message, custormContext);
                 }
             }
         }
    }
}</pre>
                </div>
            </div>
        </div>
    </body>
</html>
